package com.harboursoftware.xstorage
import org.jets3t.service.Jets3tProperties 
import org.jets3t.service.acl.AccessControlList;
import org.jets3t.service.impl.rest.httpclient.RestS3Service 
import org.jets3t.service.model.S3Bucket 
import org.jets3t.service.security.AWSCredentials 


class S3Test {

	static main(args) {

        
        Jets3tProperties props = new Jets3tProperties();
		props.setProperty('s3service.https-only', 'false')
		props.setProperty('s3service.internal-error-retry-max', '0')
		AWSCredentials credentials = new AWSCredentials('AKIAJ7UCCF3JKYC32G7Q', 'Mxw1D/zQixK8nWvNO5p9Tp5UQ/g3dVIIZa1hVi3w');
		RestS3Service s3 = new RestS3Service(credentials, 'x-storage-test', null, props);
        
        //def object = new S3Object(new File('d:/test.doc'));
		def bucket =  new S3Bucket(name : 'harboursoftware', acl : AccessControlList.REST_CANNED_PUBLIC_READ_WRITE)
		
		
		//s3.createBucket bucket

		
		
		
		println s3.getBucket( 'adfadfadfadsfadsfadsddddd')
		
		//s3.deleteBucket bucket

        //s3.putObject 'harboursoftware', object
        
		//s3.getObject (new S3Bucket("codinghorrorimg"), "codinghorror-bandwidth-usage.png")
        //s3.getObject (new S3Bucket("harboursoftware"), "test.doc")
        
        //println s3.buildPostForm("harboursoftware", "codinghorror-bandwidth-usage.png", credentials, new Date(), [] as String[], [] as String[], '', false, false, 'submit')
	}
	
	
	void getObjectWhenNoSign() {
		
	} 

}
